namespace CSharpPro._1103
{
    class Program
    {
        static void Main()
        {
            UserService userService = new UserServiceImpl();
            bool isRunning = true;

            while (isRunning)
            {
                Console.Clear();
                Console.WriteLine("===== 用户系统 =====");
                Console.WriteLine("1. 注册");
                Console.WriteLine("2. 登录");
                Console.WriteLine("3. 删除用户");
                Console.WriteLine("4. 查看所有用户");
                Console.WriteLine("5. 退出");
                Console.Write("请选择功能：");

                string choice = Console.ReadLine();
                switch (choice)
                {
                    case "1":
                        Console.Write("请输入用户名：");
                        string regUsername = Console.ReadLine();
                        Console.Write("请输入密码：");
                        string regPwd = Console.ReadLine();
                        userService.Register(regUsername, regPwd);
                        Console.ReadKey();
                        break;

                    case "2":
                        Console.Write("请输入用户名：");
                        string loginUsername = Console.ReadLine();
                        Console.Write("请输入密码：");
                        string loginPwd = Console.ReadLine();
                        userService.Login(loginUsername, loginPwd);
                        Console.ReadKey();
                        break;

                    case "3":
                        Console.Write("请输入要删除的用户名：");
                        string delUsername = Console.ReadLine();
                        userService.DeleteUser(delUsername);
                        Console.ReadKey();
                        break;

                    case "4":
                        userService.ShowAllUsers();
                        Console.ReadKey();
                        break;

                    case "5":
                        isRunning = false;
                        break;

                    default:
                        Console.WriteLine("输入无效，请重新选择！");
                        Console.ReadKey();
                        break;
                }
            }
        }
    }
}